<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<form method="post" class="form-horizontal" id="pub_form" action="{:U('Admin/Special/add_news')}" enctype="multipart/form-data" >
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">*专题名称：</label>
					<div class="span3">
						<input type="text" name="title"  style="width: 556px;" value="{$news_info.title}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">副标：</label>
					<div class="span3">
						<input type="text" name="subTitle"  style="width: 556px;" value="{$news_info.subtitle}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">关键字：</label>
					<div class="span3">
						<input type="text" name="keyword"  style="width: 556px;" value="{$news_info.keywords}">
					</div>
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">权重：</label>
					<div class="span3">
						<input type="text" name="weight"  style="width: 556px;" value="{$news_info.weight}">
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">标签：</label>
					<div class="span3">
						<input type="text" name="tags"  style="width: 556px;"  value="{$news_info.tags}">
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">专题摘要：</label>
					<div class="span7">
						<textarea style="width: 556px; height: 60px;" name="abstract">{$news_info.abstract}</textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">栏目类型：</label>
					<div class="span3">
						<select class="select_2" name="column_type" id="column_type" >
							<option value="0">全部</option>
							<foreach name="special_column_type_list" item="vo">
								<option value="{$vo.type_id}" <?php if($vo['type_id'] == $news_info['type_id']) echo "selected"?> >{$vo.name}</option>
							</foreach>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">封面图片：</label>
					<div class="span4 wrapper">
						<div id="uploader-image">
							<div id="fileList" class="uploader-list">
								<div id="imageDiv" class="file-item thumbnail" style="width:150px;height: 150px;">
								<?php if($news_info['cover_image']){?>
									<img id="imagePreview" src="<?php echo $news_info['cover_image']?>" style="width:150px;height: 140px;">
								<?php }else{?>
									<img id="imagePreview" src="__PUBLIC__/images/furley_bg.png" style="width:150px;height: 140px;">
								<?php }?>
									
									<div id="picker" class="info">选择图片&nbsp;&nbsp;&nbsp;&nbsp;</div>
									<input style="display:none;" type="file" id="imageFile" name="imageFile" >
								</div>
							</div>
						</div>
					</div><div style="color:red;float:left;margin-top:140px">*专题详细封面  尺寸：1080*328  格式：JPG/PNG</div>
				</div>
				
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">是否添加图片水印：</label>
					<div class="span3">
						<label class="radio inline" for="lightup_true"> <input type="radio" id="water_true" class="radio" name="water" value="1"  <if condition="$news_info.is_watermark eq 1"> checked </if>/>开启</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

						<label class="radio inline" for="lightup_false"> <input type="radio" id="water_false"  class="radio" name="water" value="0"  <if condition="$news_info.is_watermark eq 0">checked </if>/>关闭</label>

					</div>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">内部链接：</label>
					<div class="span3" style="width:556px">
						<input type="text" name="reference_id" id="reference_id"  style="width: 556px;" value="{$news_info.reference_id}">
						<input type="button" name="" value="维护专题" onclick="jump('{$id_type}');">
					</div>
					<?php if($news_info['reference_id'] && $news_info['reference_type']){ ?>
						<div style="float: left; margin-left: 50px;"><a href="<?php echo U('NewsManage/publish', array('news_id'=>$news_info['reference_id']));?>">维护新闻</a></div>
					<?php } ?>
				</div>
				<div class="control-group">
					<label class="span1 control-label" style="width: 90px;">发布渠道：</label>
					<div class="span3">
						<label class="radio inline" for="lightup_true"> <input type="checkbox" <if condition="$news_info.app_pub eq 1"> checked </if> id="pub" class="radio" name="pub[]" value="1" />APP</label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label class="radio inline" for="lightup_false"> <input type="checkbox" id="pub" <if condition="$news_info.web_pub eq 1"> checked </if>  class="radio" name="pub[]" value="2" />门户</label>
					</div>
				</div>

			<input type="hidden" id="classfy" name="{$id_type}" value="{$id_val}">
			<input type="hidden" name="news_id" value="{$news_info.news_id}">
			<input type="hidden" name="hidimg" value="{$news_info.cover_image}">
			<input type="hidden" name="special_id" value="{$special_id}">
			<div class="form-actions" style="padding-left:260px;">
				<button type="submit" id="quick_publish" class="btn">发布</button>
				&nbsp;&nbsp;<a class="btn" href="{:U('Admin/News/index')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
	<script type="text/javascript">
		//编辑器路径定义
		var editorURL = GV.DIMAUB;
	</script>
	<!--<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>-->
	<!--<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>-->
	<script type="text/javascript" >
		$(document).ready(function () {

			$('#channelId').change(function () {
				$.get('{:U("Admin/News/ajax_get_subject")}' + '&cateId=' + $('#channelId').val(), function (data) {
					var html = '<option value="0">--无--</option>';
					if(data['state']=="success"){
						html = '<option value="-1">全部</option>';
						for (var a in data.tagList) {
							html += '<option value="' + data.tagList[a].tagTitle + '">' + data.tagList[a].tagTitle + '</option>';
						}
					}
					$('#subjectId').html(html);
				});
			});
		});
//	    $(function() {
//				//编辑器
//				editorcontent = new baidu.editor.ui.Editor();
//
//				editorcontent.render('content');
//				try {
//					editorcontent.sync();
//				} catch (err) {
//				}
//				//增加编辑器验证规则
//				jQuery.validator.addMethod('editorcontent', function() {
//					try {
//						editorcontent.sync();
//					} catch (err) {
//					}
//					return editorcontent.hasContents();
//				});
//				var form = $('form.js-ajax-forms');
//				//ie处理placeholder提交问题
//				if ($.browser.msie) {
//					form.find('[placeholder]').each(function() {
//						var input = $(this);
//						if (input.val() == input.attr('placeholder')) {
//							input.val('');
//						}
//					});
//				}
//			////-------------------------
//		});

		function html5Reader(file, previewId){
			var file = file.files[0];
			var reader = new FileReader();
			reader.readAsDataURL(file);
			reader.onload = function(e){
				$('#'+previewId).attr('src', this.result);
			}
		}
		function image_change(fileId, previewId) {
			var pic = document.getElementById(previewId),
					file = document.getElementById(fileId);

			var ext = file.value.substring(file.value.lastIndexOf(".")+1).toLowerCase();

			// gif在IE浏览器暂时无法显示
			if(ext != 'png' && ext != 'jpg' && ext != 'jpeg'){
				alert("图片的格式必须为png或者jpg或者jpeg格式！");
				return;
			}
			var isIE = navigator.userAgent.match(/MSIE/)!= null,
					isIE6 = navigator.userAgent.match(/MSIE 6.0/)!= null;

			if(isIE) {
				file.select();
				var realLocalPath = document.selection.createRange().text;

				// IE6浏览器设置img的src为本地路径可以直接显示图片
				if (isIE6) {
					pic.src = realLocalPath;
				}else {
					// 非IE6版本的IE由于安全问题直接设置img的src无法显示本地图片，但是可以通过滤镜来实现
					pic.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='image',src=\"" + realLocalPath + "\")";
					// 设置img的src为base64编码的透明图片 取消显示浏览器默认图片
					pic.src = '';
				}
			}else {
				html5Reader(file, previewId);
			}
		}

		$("#picker").click(function(){
			$("#imageFile").click();
		});

		$("#imageFile").change(function(){
			image_change('imageFile', 'imagePreview');
		});

		function jump(classfy) {
			var news_id = $("#reference_id").val();
			var type_id = $("#classfy").val();
			window.open("<?php echo U('Admin/Special/specialAdd')?>"+'&news_id='+news_id+'&'+classfy+'='+type_id);
		}
	</script>
</body>
</html>